package com.hc.mapper;

import com.hc.entity.Permission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface PermissionMapper {
    @Select("SELECT	tb_permission.* " +
            "FROM	tb_permission " +
            "INNER JOIN	tb_role_permission ON tb_permission.id = tb_role_permission.permission_id " +
            "WHERE	tb_role_permission.role_id in  " +
            "(SELECT role_id FROM tb_user_role WHERE user_id = #{userId} ) ")
    List<Permission> selectPermissionsByUserId(Integer userId);
}
